<?php
namespace Home\Common;

class BarrierLog extends Mysql {
	function __construct(){
		parent::__construct();
	}
	
	function getBarrierLog(){
		$date 		=	session('mog_thedate');
		$serverid	=	session('mog_serverid');
		
		//查询当天成功通过的关卡
		$result	=	$this->mysql->prepare("select a.barrierid barrierid,b.barriername barriername,count(distinct(a.userid)) scd,count(a.userid) sc 
				from mog_barrier a,mog_barrier_info b 
				where a.barrierid=b.barrierig and a.status=0 and  a.thedate = \"$date\" and a.serverid=$serverid group by a.barrierid;");
		$result->execute();
		
		$reBarrier	=	array();
		while($row	=	$result->fetch(\PDO::FETCH_ASSOC)){
			$reBarrier[$row['barriername']]['scd']	=	$row['scd'];
			$reBarrier[$row['barriername']]['sc']	=	$row['sc'];
		}
		
		//查询当天未通过关卡
		$result	=	$this->mysql->prepare("select a.barrierid barrierid,b.barriername barriername,count(distinct(a.userid)) fcd,count(a.userid) fc 
				from mog_barrier a,mog_barrier_info b 
				where a.barrierid=b.barrierig and a.status=1 and  a.thedate = \"$date\" and a.serverid=$serverid group by a.barrierid;");
		$result->execute();
		
		while($row	=	$result->fetch(\PDO::FETCH_ASSOC)){
			$reBarrier[$row['barriername']]['fcd']	=	$row['fcd'];
			$reBarrier[$row['barriername']]['fc']	=	$row['fc'];
		}
		
		return $reBarrier;
	}
}
?>